namespace Sirius.Mapper.Test.TestData
{
    using System;
    using System.Collections.Generic;
    using Enities;

    public class CustomersDataSource : IDataSource
    {
        private readonly IEnumerator<Customer> enumerator;

        public CustomersDataSource(IEnumerable<Customer> customersList)
        {
            enumerator = customersList.GetEnumerator();
        }

        public bool MoveNextRow()
        {
            return enumerator.MoveNext();
        }

        public bool MoveNextSet()
        {
            return false;
        }

        public Value this[string column]
        {
            get
            {
                switch (column)
                {
                 
                    case "id":
                        return new Value { ObjectType = typeof (int), ObjectValue = enumerator.Current.Id };
                    case "parentId":
                        return new Value { ObjectType = typeof(int), ObjectValue = enumerator.Current.ParentId };
                    case "fName":
                        return new Value { ObjectType = typeof(string), ObjectValue = enumerator.Current.FirstName };
                    case "lName":
                        return new Value { ObjectType = typeof(string), ObjectValue = enumerator.Current.LastName };
                    default:
                        throw  new Exception();
                }
            }
        }
    }
}